home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / GL / flight / xasin.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  1.4 KB  |  66 lines

  1. /*
  2.  * Copyright 1984-1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17.  
  18. /*
  19.  *  flight/xasin.c $Revision: 1.4 $
  20.  */
  21. #include <gl.h>
  22.  
  23. extern int xatable1[], xatable2[], xatable3[];
  24.  
  25.  
  26. Angle xasin(r)
  27.     float r;
  28. {
  29.     register short neg;
  30.     register int i;
  31.  
  32.     i = r * 1073741824.0;
  33.     if (i < 0)
  34.     {
  35.     neg = 1;
  36.     i = -i;
  37.     }
  38.     else
  39.     neg = 0;
  40.  
  41.     if (i <= 929887697)        /* 0 - 60 degrees    */
  42.     i = xatable1[(i+1048580) >> 21];
  43.     else
  44.     {
  45.     i -= 1069655912;
  46.     if (i < -20000)
  47.         i = xatable2[((-i)-20000) >> 18];    /* 60 - 85 degrees    */
  48.     else
  49.     {
  50.         if (i > 0) 
  51.         i = (i+1895) >> 13;
  52.         else
  53.         i = 0;
  54.         if (i < 499)
  55.         i = xatable3[i];    /* 85 - 90  degrees    */
  56.         else
  57.         i = 900;
  58.     }
  59.     }
  60.  
  61.     if (neg)
  62.     return(-i);
  63.     else
  64.     return(i);
  65. }
  66.